/*
 *  MorseCode.h
 *  HelloIphone
 *
 *  Created by Geoffrey Gallaway on 2/13/09.
 *  Copyright 2009 TDK Technologies. All rights reserved.
 *
 */


#import <UIKit/UIKit.h>
#import "Tone.h"

static const struct
{
	const char letter, *morse;
} Code[] =
{   
    { ' ', " "     },
    { '0', "-----" }, { '1', ".----" }, { '2', "..---" }, { '3', "...--" },
    { '4', "....-" }, { '5', "....." }, { '6', "-...." }, { '7', "--..." },
    { '8', "---.." }, { '9', "----." },
	{ 'A', ".-"    }, { 'B', "-..."  }, { 'C', "-.-."  }, { 'D', "-.."   },
	{ 'E', "."     }, { 'F', "..-."  }, { 'G', "--."   }, { 'H', "...."  },
	{ 'I', ".."    }, { 'J', ".---"  }, { 'K', ".-.-"  }, { 'L', ".-.."  },
	{ 'M', "--"    }, { 'N', "-."    }, { 'O', "---"   }, { 'P', ".--."  },
    { 'Q', "--.-"  }, { 'R', ".-."   }, { 'S', "..."   }, { 'T', "-"     },
	{ 'U', "..-"   }, { 'V', "...-"  }, { 'W', ".--"   }, { 'X', "-..-"  },
	{ 'Y', "-.--"  }, { 'Z', "--.."  }
};

@interface MorseCode : NSObject {
	Tone *dit;
	Tone *dah;
	Tone *toneDelay;
	Tone *letterDelay;
	Tone *wordDelay;
}


@property (readwrite) Tone *dit;
@property (readwrite) Tone *dah;
@property (readwrite) Tone *toneDelay;
@property (readwrite) Tone *letterDelay;
@property (readwrite) Tone *wordDelay;

- (NSString *) encode:(NSString*)plainText;
- (void) stringToTonesList:(NSString*)text tones:(NSMutableArray*)tones;

@end
